doctype html
html
  head
    title NodeBlog
    meta(charset="utf-8")
    meta(http-equiv="X-UA-Compatible" content="IE=edge")
    meta(name="viewport" content="width=device-width, initial-scale=1")
    link(href='/stylesheets/bootstrap.min.css', rel='stylesheet' crossorigin='anonymous')
    link(rel='stylesheet', href='/stylesheets/style.css')
    link(rel='icon' href='/favicon.ico')
    link(rel='stylesheet', type="text/css", href='https://unpkg.com/trix@2.0.8/dist/trix.css')
    //- RSS 自动发现标签
    link(rel='alternate', type='application/rss+xml', title='RSS 2.0', href='/api/rss')
    link(rel='alternate', type='application/atom+xml', title='Atom 1.0', href='/api/rss/atom')
    link(rel='alternate', type='application/json', title='JSON Feed', href='/api/rss/json')

    script.
      // Toast 自动关闭功能
      document.addEventListener('DOMContentLoaded', function() {
        const toasts = document.querySelectorAll('.toast');
        toasts.forEach(function(toast) {
          // 3秒后自动关闭
          setTimeout(function() {
            toast.classList.add('hide');
            setTimeout(function() {
              toast.remove();
            }, 300);
          }, 3000);
        });
      });

    body
      .container
        img.logo(src='/images/logo.png')
        nav
          ul
            li
              a(href="/", class=(title === 'Home') ? 'active' : '') Home
            li
              a(href="/posts/add", class=(title === 'Add Post') ? 'active' : '') Add Post
            li
              a(href="/categories/add", class=(title === 'Add Category') ? 'active' : '') Add Category
            li
              a(href="/users/login", class=(title === 'Login') ? 'active' : '') Login User
            li
              a(href="/users/register", class=(title === 'Register') ? 'active' : '') Register

        //- Toast 通知容器
        #toast-container
          if msg
            - var toastClass = msgType ? 'toast show ' + msgType : 'toast show'
            div(class=toastClass)
              .toast-content
                span.toast-message= msg
                button.toast-close(onclick="this.parentElement.parentElement.remove()") ×

        main
          block content

      footer
        p.text-center Copyright &copy; 2016 MAshraf. All rights reserved.
